<?php

	header("Content-Type: text/html;charset=utf-8");

	include("function/_nosql.php"); //

	include("function/function.php");

	$redirect_urls = urlencode($_SERVER['HTTP_REFERER']);
	
	if(substr_count($redirect_urls,'login.php')>0){
		$redirect_urls = 'index.php';
	}
	if(substr_count($redirect_urls,'reg.php')>0){
		$redirect_urls = 'index.php';
	}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>会员注册_<?= $web_titles ?></title>

<meta name="Keywords" content="会员注册,<?= $web_keywords ?>" />

<meta name="Description" content="<?= $web_description ?>" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="css/common.css"/>

<link rel="stylesheet" href="css/style.css"/>
<style type="text/css">
	@media screen and (min-width:1200px ) {
		.content{
			max-width: 1200px;
		}
	}
	@media screen and (max-width:1200px ) {
		.content{
			width: 100%;
		}
		.login-box{
			float: none;
			margin: auto;
		}
	}
	@media screen and (max-width:500px ) {
		.login-box{
			width: 90%;
			height: 500px;
		}
		.login-use-btn a{
			display: block;
			margin-bottom: 10px;
		}
		.login-head{
			padding: 0 0 10px;
		}
		.login-bd .login-use-btn .use-btn{
			padding: 0;
			width: 100%;
			text-align: center;
		}
		.login-head .logo{
			margin: auto;
		}
		.login-bd .login_chest{
			width: 70px!important;
		}
		.login-bd .f-login span a{
			display: none;
		}
		.login-bd .login_chest1{
			width: 130px!important;
		}
		body{
			min-width: 100% !important;
		}
	}
	@media screen and (max-width: 410px) {
		.login-bd .login_chest1{
			width: 80px!important;
		}
		.login-box{
			height: 530px;
		}
	}
</style>
</head>

<body>

    <div class="login-wrap">

        <div class="content pb35">

			<? include("_include.login.head.php") ?>

            <div class="login-box" style="height: 500px;">
								<?php

								if($_SESSION['kboy_qq_login'] || $_SESSION['kboy_weibo_login'] ){

								?>

									<div class="title">请绑定中国徒步网</div>

								<?php

										}else{

								?>

									<div class="title">欢迎注册中国徒步网</div>

								<?php

										}

								?>
                

				<form name="regform" id="regform" method="post" action="regsave.php?action=save">

				<input type="hidden" name="redirect_urls" id="redirect_urls" value="<?=$redirect_urls?>" />

                <div class="login-bd pt24">

                	<div class="f-login-hd">

                        <h3 class="p-style">

                            <a href="reg.php" class="aa on">邮箱注册</a>|<a href="reg_phone.php">手机注册</a>

                        </h3>

                    </div>

                    <div class="f-login-wrap">

                        <div class="f-login-pane current">

		                    <div class="f-login">

		                        <input name="user_email" id="user_email" type="text" placeholder="Email" class="login-input login_mess" value="">

		                    </div>

		                    <p class="email_text"></p>

		                    <div class="f-login">

		                        <input name="user_emailcode" type="text" class="login-input login_chest1" id="user_emailcode" value="" placeholder="验证码">

		                        <span class="get-yzm"><a href="alert.getemail.php?action=reg" class="email-yzm" >获取验证码</a>

								</span>

		                    </div>

		                    <p></p>

		                    <div class="f-login">

		                        <input name="user_password" id="user_password" type="password" placeholder="密码" class="login-input login_password" value="">

		                    </div>

		                    <p class="password_text"></p>

		                    <div class="f-login">

		                        <input name="user_repassword" id="user_repassword" type="password" placeholder="重复密码" class="login-input login_password" value="">

		                    </div>

		                    <p class="password_text"></p>

		                    <div class="f-login">

		                        <input name="user_realname" id="user_realname" type="text" placeholder="真实姓名" class="login-input login_password" value="">

		                    </div>

		                    <div class="f-login-bd protocol">

		                        <span class="auto-login"><label><input type="checkbox" name="user_isgree" id="user_isgree" value="1"/>我已阅读并同意<a href="#">《徒步网社区用户注册协议》</a></label></span>

		                    </div>

		                    <div class="login-btn">

								<?php

										if($_SESSION['kboy_qq_login'] || $_SESSION['kboy_weibo_login'] ){

								?>

									<input type="submit" name="reg_btn" class="basic-btn" value="立即绑定" />

								<?php

										}else{

								?>

									<input type="submit" name="reg_btn" class="basic-btn" value="立即注册" />

								<?php

										}

								?>

								<br /><a href="login.php">已有账号？去登录？</a>

							</div>                           

                        </div>

                        

                    </div>

                </div>

				</form>

            </div>         

            <div class="clearfix"></div>

            <div class="recommend-line">

                <div class="line-label">路线推荐</div>

                <div class="line-show">

                    <div class="bd">

                        <ul class="infoList">

						<?php

								$news_sql = "select * from kboy_forum_active order by active_top desc,active_order desc, id desc limit 5";

								$news_rows = mysql_query($news_sql);

								while($news_rs = mysql_fetch_array($news_rows)){

									echo "<li><a href=\"activeview.php?newsid=".$news_rs['id']."\" target=\"_blank\">".$news_rs['active_title']."</a></li>";

								}

						?>

<!--                            <li><a href="#">蜕变之旅 朝圣梅里大转山 赠HASKI千元礼包</a></li>

                            <li><a href="#">农场摘菜不如在线学外语好玩农场摘菜不如在线学外语好玩农场摘菜不如在线学外语好玩</a></li>

                            <li><a href="#">数理化老师竟也看学习资料？</a></li>

                            <li><a href="#">学外语，上北外！</a></li>

                            <li><a href="#">那些无法理解的荒唐事</a></li>

-->                        </ul>

                    </div>

                </div>

                <div class="close"><img src="images/close.png" width="21" height="21" alt=""/></div>

            </div>

        </div>

		<div id="msgcontent">

		</div>

        <!--版权信息-->

		<? include("_include.login.copyright.php") ?>

    </div>

    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>

    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>

    <script type="text/javascript" src="js/login.js"></script>

    <script type="text/javascript" src="layer/layer.js"></script>

    <script type="text/javascript" src="js/alert.js"></script>

	<script type="text/javascript">

	$(document).ready(function(){

		// 刷新验证码

		// 用户名验证

		$("#user_email").blur(function(){

			$.ajax({ 

				url:'regsave.php', 

				type:'post',

				dataType:'html',

				data:'action=chkuser&user_email=' + $("#user_email").val() + '&date='+new Date(),

				error: function(){

					layer.msg('Error loading document'); 

				},success: function(msg){

					if(msg == 1){

						$(".email_text").html("");

					}else{

						$(".email_text").html(msg);

					}

				} 

			}); 

		});

		

		// 表单提交

		$("#regform").submit(function(){

			var user_email = $("#user_email").val();

			var user_email_rule = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

			var user_emailcode = $("#user_emailcode").val();

			var user_password = $("#user_password").val();

			var user_repassword = $("#user_repassword").val();

			var user_realname = $("#user_realname").val();

			var user_isgree = $("#user_isgree").is(":checked");



			

			// 邮箱验证

			if(!user_email_rule.test(user_email)){

				alert("邮箱格式错误！");

				$("#user_email").focus();

				return false;

			}

			

			// 验证码验证

			if (user_emailcode.replace(/\ /g,"").length<1){

				alert("请正确输入验证码！");

				$("#user_emailcode").focus();

				return false;

			}



			// 密码验证

			if(user_password.replace(/\ /g,"").length<5){

				alert("密码不能少于5位字符！");

				$("#user_password").focus();

				return false;

			}

			if(user_repassword.replace(/\ /g,"").length<5){

				alert("两次密码输入不一致！");

				$("#user_repassword").focus();

				return false;

			}

			if(user_password != user_repassword){

				alert("两次密码输入不一致！");

				$("#user_password").focus();

				return false;

			}

			if(user_realname.replace(/\ /g,"").length<2){

				alert("请输入真实姓名！");

				$("#user_realname").focus();

				return false;

			}

			if (!user_isgree){

				alert("请勾选注册协议！");

				return false;

			}

		});

	});

</script>

</body>

</html>

